﻿namespace System.Windows.Data
{
    /// <summary>
    /// <see cref="Boolean">Boolean</see> to <see cref="Visibility">visibility</see> <see cref="IValueConverter">value converter</see>.
    /// </summary>
    public class BooleanToVisibilityConverter : RevertibleBooleanToAnythingConverter
    {
        #region Overrides of RevertibleBooleanToAnythingConverter

        /// <summary>
        /// Direct value for conversion.
        /// </summary>
        protected override object DirectValue
        {
            get { return Visibility.Visible; }
        }
        
        /// <summary>
        /// Opposite-to-Direct value for conversion.
        /// </summary>
        protected override object OppositeValue
        {
            get { return Visibility.Collapsed; }
        }

        /// <summary>
        /// Determines whether value is DirectValue.
        /// </summary>
        /// <param name="value">Value.</param>
        /// <returns>True, if DirectValue, otherwise - false.</returns>
        protected override bool IsDirectValue(object value)
        {
            return ((Visibility)value == Visibility.Visible);
        }

        #endregion
    }
}
